<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="../js/jquery-3.5.1.min.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<input type="text" class="p1" value="18"/> VS <input type="text" class="p2" value="20"/>
		<input type="button" class="p3" value="最大数是？" /> <input type="text" class="p4" value="" />
		
		<script type="text/javascript">
			$(function(){
				$(".p3").click(function(){
					var a = $(".p1").val();
					var b = $(".p2").val();
					var a1 = a.match(/\d+/ig);
					var b1 = b.match(/\d+/ig);
					for(var i = 0;i < a1.length;i++){
						a1[i] =  parseInt(a1[i],10);
						for(var j = 0;j < b1.length;j++){
							b1[j] =  parseInt(b1[j],10);
							if(a1[i] > b1[j]){
								$(".p4").val(a1[i]);
							}else{
								$(".p4").val(b1[j]);
							}
							console.log(a1[i]);
							console.log(b1[j]);
						}
						
						
						
						
					}
					
				})
			})
		</script>
	</body>
</html>
